package com.fzb.zrlog.simple.dao.impl;

import com.fzb.common.dao.impl.DAO;
import com.fzb.zrlog.simple.dao.api.IWebSiteDAO;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class WebSite extends DAO implements IWebSiteDAO {
    public WebSite() {
        tableName = "website";
        pk = "siteId";
    }

    @Override
    public Map<String, Object> getWebSite() {
        Map<String, Object> webSites = new HashMap<>();
        try {
            List<Map<String, Object>> lw = queryList(ALL);
            for (Map<String, Object> webSite : lw) {
                webSites.put(webSite.get("name").toString(), webSite.get("value"));
                webSites.put(webSite.get("name") + "Status", webSite.get("status"));
                webSites.put(webSite.get("name") + "Remark", webSite.get("remark"));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return webSites;

    }

    @Override
    public boolean updateByKV(String name, String value, boolean status) {
        return false;
    }

}
